//
//  XLPPCollectionViewCell.m
//  XiangLove
//
//  Created by 陈宪栋 on 2017/12/19.
//  Copyright © 2017年 BAOMIHUA.COM. All rights reserved.
//

#import "XLPPCollectionViewCell.h"

@implementation XLPPCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = XLThemeColor;
        [self setupView];
    }
    return self;
}

- (void)setupView {
    
    [self.contentView addSubview:self.coverImageView];
    [self.coverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5, 5, 0, 5));
    }];
    
    _playIconImageView = [[UIImageView alloc] init];
    _playIconImageView.image = [UIImage imageNamed:@"xl_play_small_icon"];
    [self.contentView addSubview:_playIconImageView];
    [_playIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(24, 24));
    }];
    
    //播放 喜欢
    
    [self.contentView addSubview:self.playCollect];
    
    [self.playCollect mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(8);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-9);
        make.height.mas_equalTo(14);
    }];

    //视频名称
    
    [self.contentView addSubview:self.videoName];
    
    [self.videoName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.playCollect.mas_left);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-10);
//        make.width.lessThanOrEqualTo(self.contentView.mas_right).offset(-8);
        make.width.lessThanOrEqualTo(self.contentView).offset(-17);
        make.height.mas_equalTo(21);
    }];
    
        
}

- (UIImageView *)coverImageView
{
    if (!_coverImageView) {
        self.coverImageView = [[UIImageView alloc] init];
        self.coverImageView.clipsToBounds = YES;
        self.coverImageView.contentMode = UIViewContentModeScaleAspectFill;
    }
    
    return _coverImageView;
}

- (UILabel *)playCollect
{
    if (!_playCollect) {
        self.playCollect = [[UILabel alloc] init];
        self.playCollect.hidden = YES;
        self.playCollect.font = [UIFont fontWithName:@"PingFangSC-Regular" size:10];
        self.playCollect.textColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
        self.playCollect.textAlignment = NSTextAlignmentLeft;
    }
    
    return _playCollect;
}

- (UILabel *)videoName
{
    if (!_videoName) {
        self.videoName = [[UILabel alloc] init];
        self.videoName.textAlignment = NSTextAlignmentLeft;
        self.videoName.textColor = [UIColor whiteColor];
        self.videoName.font = [UIFont systemFontOfSize:15];
    }
    
    return _videoName;
}


@end
